﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using VistaDB;
using VistaDB.DDA;


namespace SampleForm {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e) {
            this.textBox1.Text = string.Empty;
            CodePlex.VistaDB.Library.Schema schema = new CodePlex.VistaDB.Library.Schema();
            string dbFileName = @"insert database filename here";
            string exportFileName = @"insert export schema destinatin filename here";
            IVistaDBDatabase db = CodePlex.VistaDB.Library.GetDatabase(dbFileName, "password", VistaDBDatabaseOpenMode.NonexclusiveReadOnly);
            schema.ExportDBSchema(exportFileName, db);
            this.textBox1.Text = System.IO.File.ReadAllText(exportFileName);
            MessageBox.Show("Tab-delimited schema can be found at " + exportFileName);
        }
    }
}
